package main

import (
	"log"
	"os"
	"text/template"
)

func main() {

	t := template.Must(template.ParseGlob("./views/*.tpl"))
	type GameStatus struct {
		Name  string
		IsWin bool
	}

	var userStatus = []GameStatus{
		{"大春", true},
		{"NiuBee", false},
		{"球球", true},
	}

	for _, u := range userStatus {
		//根据参数u, 渲染命名为demo的模板，并且将渲染结果打印到标准输出
		err := t.ExecuteTemplate(os.Stdout, "demo", u)
		if err != nil {
			log.Println("executing template:", err)
		}
	}

}
